﻿using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;

namespace ExchangeExample.WP7.Models
{
    [XmlRoot("Root")]
    public class RatesList
    {
        [XmlArray("Results")]
        [XmlArrayItem("Element")]
        public ObservableCollection<Rate> Collection { get; set; }
    }

    public class Rate
    {
        [XmlElement("Currency")]
        public string Currency { get; set; }
        private double _Buy;
        [XmlElement("Buy")]
        public double Buy 
        {
            get 
            {
                return Math.Round(_Buy, 2);
            }
            set
            {
                _Buy = value;
            }
        }
        private double _Sale;
        [XmlElement("Sale")]
        public double Sale 
        { 
            get
            {
                return Math.Round(_Sale,2);
            }
            set 
            {
                _Sale = value;
            }
        
        }
    }
}

